import { IFeidaoAiBrowserComponent } from '@dfeidao/atom-web/interfaces';
import get from '@dfeidao/atom-web/local/get';

import error from '@dfeidao/atom-web/msgbox/error';

import fire from '@dfeidao/atom-web/msg/fire';

import tree from '@dfeidao/fd-w000001';

export default async function a009(fd: IFeidaoAiBrowserComponent) {
	// 添加
	const zds = fd.data.node.querySelector('[zds]') as tree;
	const checked = zds.get_checked();
	const tenantid = get(fd, 'tenantid') as string;

	if (checked.length === 0) {
		error('请选择一个功能定义');
		return;
	}
	const arr = new Array();
	checked.forEach((v: { no: string, formid: string }) => {
		if (v.no) {
			arr.push(v.formid);
		}
	});

	fire('zj-000002', 'a001', { arr, tenantid });
	// const a = new Map();
	// a.set('a', { left: { "aa": "bb", "cc": "dd" }, right: [{ '11': '22', '33': '44', '55': '66' }] });
	// a.set('b', { left: { "ee": "ff", "gg": "hh" }, right: [{ '77': '88', '99': '00' }] });
	// for (const key of a.keys()) {
	// 	// console.log(key);
	// }
	// const obj = a.keys();
	// for (const i in obj) {
	// 	console.log(i);
	// }
}
